-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Fix: Suppress EAI_NODATA error for IPv4/IPv6-only domains #14013
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Fix: Suppress EAI_NODATA error for IPv4/IPv6-only domains #14013
Conversation
This change prevents getaddrinfo() from throwing an error when a domain only has A records (IPv4) or AAAA records (IPv6), which is expected behavior for single-stack domains. Fixes microsoft#13937 and microsoft#13820
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes unnecessary error logging when WSL performs connection checks on domains that only support IPv4 or IPv6. The change suppresses the EAI_NODATA error returned by getaddrinfo() when a domain lacks records for the requested address family (e.g., IPv4-only domains have no AAAA records), which is expected behavior and should not generate error logs.
Key Changes:
- Added special handling for EAI_NODATA error code after
getaddrinfo()calls - Returns an empty socket instead of throwing an exception when EAI_NODATA is encountered
- Connection check continues normally for the available address family while skipping the unavailable one
|
@copilot open a new pull request to apply changes based on the comments in this thread |
|
@microsoft-github-policy-service agree |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
OneBlue
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for doing this ! It's looking like the PR changes the line endings for this file, which makes its difficult to review, can you revert to the original line endings so we can review the change ?
…b.com/klabacher/WSL into fix/suppress-getaddrinfo-nodata-error
|
FIxed CRLF formatting |
I'm not sure you did, still showing a lot of changed whitespace in the file. |
|
I'm sorry about this inconvenience. I will provide a proper fix! |
Summary
This PR suppresses EAI_NODATA from getaddrinfo() during connection checks, which occurs for domains that only have A (IPv4) or AAAA (IPv6) records and is expected behavior for single-stack domains.
Instead of throwing (and spamming logs), the code returns an empty socket so the connection attempt is skipped for the missing address family while still allowing checks to proceed normally.
Context / Motivation
WSL may log CheckConnection: getaddrinfo() failed for domains that are IPv4-only or IPv6-only, even though networking continues to work.
This change avoids unnecessary error logs while keeping real failures intact (non-EAI_NODATA errors still throw).
Changes
Handle status == EAI_NODATA right after getaddrinfo() and return an empty socket (unique_socket) instead of throwing.
Change is isolated to src/shared/inc/conncheckshared.h.
Issues
Fixes #13937 and #13820.
Validation steps performed
Ran simple validation on an isolated x64 environment:
Started WSL and verified general connectivity works as expected (internet OK).
Verified IPv6 did not trigger the previous error condition (no IPv6-related error observed).
Confirmed the log spam does not occur after the change for single-stack scenarios.